package com.cyu.invoicing.dao;

import com.cyu.invoicing.model.vo.UserVo;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author 刘
 */
@Component
public interface UserDAO {
    /**
     * 插入用户实体
     * @param user
     * @return
     */
    @Insert("insert into lz_sys_user" +
            "(account, password,roleId,roleName," +
            "employeeId,updater,updatime,state,isLocked,lockTime) " +
            "values" +
            "(#{account},#{password},#{roleId}," +
            "#{roleName},#{employeeId},#{updater},#{updatetime}," +
            "#{status},#{isLocked},#{lockTime})")
    int insertUser(UserVo user);


    /**
     * 返回员工信息
     * @return
     */
    @Select("SELECT * FROM `lz_sys_user`")
    List<UserVo> listUser();

    /**
     * 更新员工密码信息
     * @param userVo
     * @return
     */
    @Update("update lz_sys_user " +
            "set password=#{password} where account=#{account} ")
    int updateUser( UserVo userVo);
}
